package org.dbstar.scheduler.beans;

import java.io.Serializable;
import java.util.Map;

/**
 * 匹配的Job依赖与触发
 * 
 * @author 代波
 * @since 1.0.0
 * @version 1.0.0
 * @date 2012-6-13
 */
public class MatchJobDependency implements Serializable {
	private static final long serialVersionUID = -9171614597377429812L;

	private final JobDependency dependency;
	private final Map<String, String> parameters;

	public MatchJobDependency(JobDependency dependency, Map<String, String> parameters) {
		super();
		this.dependency = dependency;
		this.parameters = parameters;
	}

	public JobDependency getDependency() {
		return dependency;
	}

	public Map<String, String> getParameters() {
		return parameters;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dependency == null) ? 0 : dependency.hashCode());
		result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MatchJobDependency other = (MatchJobDependency) obj;
		if (dependency == null) {
			if (other.dependency != null)
				return false;
		} else if (!dependency.equals(other.dependency))
			return false;
		if (parameters == null) {
			if (other.parameters != null)
				return false;
		} else if (!parameters.equals(other.parameters))
			return false;
		return true;
	}
}
